#include <iostream>
#include <unordered_set>
#include <vector>
#include <algorithm>

using namespace std;
const int N = 1010;
int f[N];
int a[15], b[15];
int n, m;

int sg(int root)
{
    if(f[root] != -1) return f[root];
    unordered_set<int> mp;
    for(int i = 1; i <= m && root - b[i] >= 0; i++) mp.insert(sg(root - b[i]));
    for(int i = 0; ; i++)
        if(!mp.count(i)) 
            return f[root] = i;
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= N; i++) f[i] = -1;
    cin >> m;
    for(int i = 1; i <= m; i++) cin >> b[i];
    sort(b + 1, b + 1 + m);
    int s = 0;
    for(int i = 1; i <= n; i++) s ^= sg(a[i]);
    if(s)
    {
        cout << "YES" << endl;
        for(int i = 1; i <= n; i++)
            for(int j = 1; j <= m && a[i] - b[j] >= 0; j++)
                if((s ^ f[a[i]] ^ f[a[i] - b[j]]) == 0)
                {
                    cout << i << " " << b[j] << endl;      
                    return 0;
                }
    }
    else cout << "NO" << endl;
    return 0;
}